home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.5 KB | 63 lines | [TEXT/GEOL] |
- Item 1937673 15-Jan-91 14:12PST
-
- From: KNEPPER Knepper, Christopher
-
- To: CPLUS.DEV$ C++ Interest List--Developers
- MACAPP.TECH$ MacApp Technical
- CPLUS.APPLE$ C++ Interest List--Apple Employees
-
- Item forwarded by SPA.DTS to SPA0144
-
- Item forwarded by FRED.FORSMAN to CPLUS.BUGS
-
-
- ------------------------------------------------------------------------------
-
- Sub: CFront: PascalObject bug!
-
- TWIMC:
-
- There is a serious bug in CFront in the implementation of PascalObject.
- Whenever a virtual member function is called from within the "lowest"
- implementation of that function, the function is not called polymorphically.
-
- -Chris
-
- Example follows:
-
- class TParent : public PascalObject {
- public:
- TParent *fMember;
-
- virtual pascal void VirtualMemberFunction();
- };
-
- class TChild : public TParent {
- public:
-
- virtual pascal void VirtualMemberFunction();
- };
-
-
- pascal void TParent::VirtualMemberFunction(void)
- {
- fMember->VirtualMemberFunction(); // BUG occurs here!
- }
-
- pascal void TChild::VirtualMemberFunction(void)
- {
- fMember->VirtualMemberFunction(); // calls TParent$VirtualMemberFunction
- }
-
- /* NOTE: Bug. In TParent::VirtualMemberFunction, the call
- * fParent->VirtualMemberFunction();
- *
- * generates a call to:
- * TParent_VirtualMemberFunction( (*this)-> fParent) ;
- *
- * it should generate a call to:
- * TParent$VirtualMemberFunction( (*this)-> fParent) ;
- */
-
-
-